package com.telenav.common.ui;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.ImageSpan;

import com.telenav.app.R;

public class Util {

	public static Bitmap drawPoint(int size, int position, Context context) {
		
		if(size <= 0)
	    	return null;
	    
		Bitmap unfocus = ((BitmapDrawable)context.getResources().getDrawable(R.drawable.product_point_normal)).getBitmap();
	    Bitmap focus = ((BitmapDrawable)context.getResources().getDrawable(R.drawable.product_point_selected)).getBitmap();
	    Bitmap newImage = Bitmap.createBitmap(size * 25, 25, Bitmap.Config.ARGB_8888);
	    Canvas localCanvas = new Canvas(newImage);
	    for(int i = 0; i <= size; i++)
	    {
	    	if (i == position)
	    	{
	    	   localCanvas.drawBitmap(focus, i*25, 0.0F, null);
	    	}
	    	else
	    	{
	    		localCanvas.drawBitmap(unfocus, i*25, 0.0F, null);
	    	}
	    }
		return newImage;

	}
	
	public static SpannableString convertSimlies(Context context, String message)
	{
		SpannableString ss = new SpannableString(message);  
        Drawable image = ((BitmapDrawable)context.getResources().getDrawable(R.drawable.product_point_normal));
 	   
        return ss;
	}
}
